/*!
 * avangard/game_controller.js
 * © 2009 avangardonline.ru
 * @author BlooDHounD <http://www.controller.by>
 */

if ( !window.controller ) throw new Error( '"controller" not initialized' );

controller.require( 'avangard' );

if ( !avangard.GameController ) {

	controller.require( 'controller.events.EventDispatcher' );

	/**
	 * класс работы с чатом
	 * @class
	 * @namespace	avangard
	 * @extends		controller.events.EventDispatcher
	 * @requires	avangard.chat.ChatController
	 * @requires	avangard.BattleController
	 * @author		BlooDHounD	<http://www.controller.by>
	 */
	avangard.GameController = function() {

		//--------------------------------------------------------------------------
		//
		//  Class variables
		//
		//--------------------------------------------------------------------------

		/**
		 * @private
		 */
		var	doc =		window.document,
			b =			controller;

		//--------------------------------------------------------------------------
		//
		//  Constructor
		//
		//--------------------------------------------------------------------------

		/**
		 * @constructor
		 * @param	{controller.SocialApi}
		 */
		var GameController = function(api) {
			GameController.superPrototype.constructor.call( this );
			this._api = api;
		};

		b.extend( GameController, b.events.EventDispatcher );

		var GameControllerPrototype = GameController.prototype;

		//--------------------------------------------------------------------------
		//
		//  Variables
		//
		//--------------------------------------------------------------------------

		/**
		 * @private
		 * @type	{avangard.BattleController}
		 */
		GameControllerPrototype._battle = null;

		/**
		 * @private
		 * @type	{avangard.chat.ChatController}
		 */
		GameControllerPrototype._chat = null;

		/**
		 * @private
		 * @type	{avangard.BattleController}
		 */
		GameControllerPrototype._api = null;

		//--------------------------------------------------------------------------
		//
		//  Properties
		//
		//--------------------------------------------------------------------------

		//--------------------------------------------------------------------------
		//
		//  Event handlers
		//
		//--------------------------------------------------------------------------

		//--------------------------------------------------------------------------
		//
		//  Methods
		//
		//--------------------------------------------------------------------------

		/**
		 * @method
		 * @return	{avangard.chat.ChatController}
		 */
		GameControllerPrototype.getChatController = function() {
			return this._chat;
		};

		/**
		 * @method
		 * @param	{avangard.chat.ChatController}	controller
		 */
		GameControllerPrototype.setChatController = function(controller) {
			this._chat = controller;
		};

		/**
		 * @method
		 * @return	{avangard.BattleController}
		 */
		GameControllerPrototype.getBattleController = function() {
			return this._battle;
		};

		/**
		 * @method
		 * @param	{avangard.BattleController}		controller
		 */
		GameControllerPrototype.setBattleController = function(controller) {
			this._battle = controller;
		};

		/**
		 * @method
		 * @override
		 * @return	{String}
		 */
		GameControllerPrototype.toString = function() {
			return '[GameController object]';
		};

		//--------------------------------------------------------------------------
		//
		//  Class methods
		//
		//--------------------------------------------------------------------------

		/**
		 * @static
		 * @method
		 * @override
		 * @return	{String}
		 */
		GameController.toString = function() {
			return '[class GameController]';
		};

		return GameController;

	}();

}